﻿<template>
    <div>
        <h2>{{hello}}</h2>
        <input type="text" placeholder="想要请求哪个id" v-model="sendId" @keyup.enter="axiosJieShou"/> 
    </div>
</template>

<script>
    import axios from 'axios'
    export default {
    name: 'hello',
    components: {},
    data() {
        return {
            hello:'你好,Vue',
            sendId:'',

        }
    },
    mounted(){
    },
    methods:{
        axiosJieShou(){
            axios.get(`http://y39406f563.51vip.biz:59431/${this.sendId}/getPerson`).then(
                response=>{
                    console.log('请求成功了',response.data)
                    //console.log(this)//VueComponent
                    this.$bus.$emit('sendMessage',response.data)
                },
                error=>{
                    console.log('请求失败了',error.message)
                }
            )
        }
    }
    }
</script>

<style>

</style>